package com.bzframework.example.cloud.user.web;

import com.bzframework.example.cloud.user.config.NacosParamConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author bingzhong
 * @Date 2025/10/25
 */
@Slf4j
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final NacosParamConfig nacosParamConfig;

    @GetMapping("/{id}")
    public ResponseEntity<String> getUserById(@PathVariable String id) {
        log.info("获取用户的id:{}", id);
        return ResponseEntity.ok("userId: " + id);
    }

    @GetMapping("/config")
    public ResponseEntity<String> getConfig() {
        return ResponseEntity.ok(nacosParamConfig.getName());
    }

}
